//
//  HESickbedPlanItemCell.m
//  HealthElderly
//
//  Created by 吴欧 on 2021/5/14.
//  Copyright © 2021 honglutec. All rights reserved.
//

#import "HESickbedPlanItemCell.h"
#import "HESickedModel.h"

@interface HESickbedPlanItemCell ()

@end

@implementation HESickbedPlanItemCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = KWhiteColor;

        [self initUI];
    }
    return self;
}

- (void)initUI {
    
    UILabel *serverNameLb = [UILabel new];
    _serverNameLb = serverNameLb;
    serverNameLb.text = @"服务项目";
    serverNameLb.font = DYFont(17);
    serverNameLb.textAlignment = NSTextAlignmentCenter;
    serverNameLb.numberOfLines = 0;
    [self.contentView addSubview:serverNameLb];
    
    UILabel *serverDateLb = [UILabel new];
    _serverDateLb = serverDateLb;
    serverDateLb.text = @"服务日期";
    serverDateLb.font = DYFont(17);
    serverDateLb.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:serverDateLb];
    
    UILabel *serverStateLb = [UILabel new];
    _serverStateLb = serverStateLb;
    serverStateLb.text = @"服务状态";
    serverStateLb.font = DYFont(17);
    serverStateLb.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:serverStateLb];
    
    UIView *line1 = [UIView new];
    line1.backgroundColor = CSplitLineColor;
    [self.contentView addSubview:line1];
    
    UIView *line2 = [UIView new];
    line2.backgroundColor = CSplitLineColor;
    [self.contentView addSubview:line2];
    
    [serverNameLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(15);
        make.left.equalTo(self.contentView);
        make.width.mas_equalTo(self.contentView.mas_width).multipliedBy(0.4);
        make.bottom.equalTo(self.contentView).offset(-15);
    }];
    
    [serverDateLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(serverNameLb.mas_right);
        make.width.mas_equalTo(self.contentView.mas_width).multipliedBy(0.35);
        make.bottom.equalTo(self.contentView);
    }];
    
    [serverStateLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(serverDateLb.mas_right);
        make.right.equalTo(self.contentView);
        make.width.mas_equalTo(self.contentView.mas_width).multipliedBy(0.25);
        make.bottom.equalTo(self.contentView);
    }];
 
     
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(serverNameLb.mas_right).offset(-1);
        make.width.mas_equalTo(1);
        make.height.mas_equalTo(20);
    }];
    
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(serverDateLb.mas_right).offset(-1);
        make.width.mas_equalTo(1);
        make.height.mas_equalTo(20);
    }];
  
}

- (void)configCellWithModel:(HESickedPlanModel *)model indexPath:(NSIndexPath *)indexPath {
    _serverNameLb.text = model.service_name;
    _serverDateLb.text = model.service_date;
    _serverStateLb.text = model.KStatusText;
    _serverStateLb.textColor = model.KStatusTextColor;
}

@end
